package com.xin.motion
{
import com.xin.vo.Vector2D;
import flash.display.DisplayObject;


/**
 * 移动缓动
 * @author daichangxin
 */
public class MoveAnimation extends AnimationBase
{
	protected var _target:DisplayObject;
	protected var _startPos:Vector2D;
	protected var _endPos:Vector2D;
	
	public function MoveAnimation(target:DisplayObject, startPos:Vector2D, endPos:Vector2D, duration : uint)
	{
		_target = target;
		_startPos = startPos;
		_endPos = endPos;
		
		super(duration);
	}

	override protected function onValueUpdate() : void
	{
		var currentPos:Vector2D = (_endPos.subtract(_startPos).multiProd(this.value)).add(_startPos);
		_target.x = currentPos.x;
		_target.y = currentPos.y;
	}

}
}
